package org.seven.jrdp.web.mgt.core;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.seven.jrdp.biz.sys.service.SysParamService;
import org.seven.jrdp.commons.config.ParamConfig;
import org.seven.jrdp.commons.constant.GlobalContants;
import org.seven.jrdp.commons.util.ServletUtils;

public class MgtCoreListener implements ServletContextListener {
	public void contextInitialized(ServletContextEvent servletContextEvent) {
		SysParamService sysParamService = ServletUtils.getBean(SysParamService.class);
		ServletContext servletContext = ServletUtils.getServletContext();
		Map<String, String> paramMap = sysParamService.getParamMap();
		ParamConfig.init(paramMap);
		servletContext.setAttribute(GlobalContants.APPLICATION_PARAM, paramMap);
		servletContext.setAttribute(GlobalContants.APPLICATION_CTX, servletContext.getContextPath());
	}

	public void contextDestroyed(ServletContextEvent servletContextEvent) {
	}
}